<%@ page import="org.apache.commons.fileupload.FileItem" %>
      <%@ page import="java.util.List" %>
      <%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory" %>
      <%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload" %>
      <%@ page import="org.apache.commons.io.FilenameUtils" %>
      <%@ page import="java.io.*" %>
      <%@ page contentType="text/html;charset=GB2312" language="java"%>
<%
String clientPath = "";
	//	System.out.println("enter jsp");

try {

    if (ServletFileUpload.isMultipartContent(request)) {
	
	ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
	List<FileItem> fileItemsList = servletFileUpload.parseRequest(request);
	//	System.out.println("enter multipart");


	for (FileItem item : fileItemsList) {
	    String filename="netdriver.xls";
	    if (!item.isFormField()) {
		clientPath = "papers/" + filename; 
		File file = new File(application.getRealPath(clientPath));
		if (!file.getParentFile().exists()) {
		    file.getParentFile().mkdirs();
		}
	//		System.out.println(file.toString());

		item.write(file);
		// response.sendRedirect("./driveTimeDBJob.brl");

	    }
	}
    }
        PrintWriter writer = response.getWriter();
    writer.write(" multipartOk");

} catch (Exception ee)
{
%>
<%= ee.getMessage() %>
<%
}
%>

